package hello.test;

import hello.A11StringUtil;

import org.junit.Test;
import static org.junit.Assert.*;

public class SubStrByteLength {
	@Test
	public void testInvalidArgsNegativeStart() {
		String result = A11StringUtil.substrByteLength("aa", -1, 1);
		assertEquals("", result);
	}
	@Test
	public void testInvalidArgsNegativeLength() {
		String result = A11StringUtil.substrByteLength("aa", 1, -1);
		System.out.println(result);
		assertEquals("", result);
	}
	@Test
	public void testInvalidArgsToLargeLength() {
		String result = A11StringUtil.substrByteLength("aa", 1, 100);
		assertEquals("", result);
	}
	@Test
	public void testInvalidArgsToLargeStart() {
		String result = A11StringUtil.substrByteLength("aa", 100, 1);
		assertEquals("", result);
	}
	
	@Test
	public void cutAlphabetCharacter(){
		String result = A11StringUtil.substrByteLength("Hello", 2, 2);
		assertEquals("ll", result);
	}

	@Test
	public void testSubHiragana(){
		String test = A11StringUtil.substrByteLength("テクノロジックアートは、「最先端の技術でユーザーニーズに応える」",3,10);
		assertTrue(test.equals("ロジッ"));
	}
	
	@Test
	public void testNormalString() {
		String result = A11StringUtil.substrByteLength("Hello World", 2, 2);
		assertEquals("ll", result);
	}

	@Test
	public void testEmptyString() {
		String result = A11StringUtil.substrByteLength("", 2, 2);
		assertEquals("", result);
	}
	
	@Test
	public void testNullString() {
		String result = A11StringUtil.substrByteLength(null, 2, 2);
		assertEquals(null, result);
	}

	@Test
	public void testTiengVietString() {
		String result = A11StringUtil.substrByteLength("tôi là vũ", 1, 4);
		assertEquals("ôi", result);
	}
	
	@Test
	public void testJapanString(){
		String result = A11StringUtil.substrByteLength("マイホーム", 1, 6);
		assertEquals("イホ", result);
	}
	
}
